package com.ky.pro.java.fx.spring.entity.configuration;

import com.ky.pro.java.fx.spring.entity.Klass;
import com.ky.pro.java.fx.spring.entity.School;
import com.ky.pro.java.fx.spring.entity.Student;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @ClassName SchoolConfiguration
 * @Description TODO
 * @Date 2021/12/4 15:47
 * @Author kevin
 **/
@Configuration
public class SchoolConfiguration {

    @Bean("student-201")
    Student genStudent201() {
        Student student = new Student();
        student.setId(201L);
        student.setName("kevin-c");
        return student;
    }

    @Bean("klass-11c")
    Klass genKlass11c() {
        Klass klass = new Klass();
        klass.setId(201L);
        klass.setName("1-1-c");
        klass.addStudent(genStudent201());
        return klass;
    }

    @Bean("conf-school-001")
    School genSchool() {
        School school = new School();
        school.setId(201L);
        school.setName("School of Configuration");
        school.addKlass(genKlass11c());
        return school;
    }

}
